package com.helloworld.chat.utils;

import sun.misc.BASE64Encoder;

import java.security.MessageDigest;
import java.security.NoSuchAlgorithmException;

/**
 * Created by xdzy on 2017/6/28.
 */
public class MD5Util {

    public static String makeMD5Code(String origin){
        try {
            MessageDigest md= MessageDigest.getInstance("MD5");
            md.update(origin.getBytes());
            BASE64Encoder be=new BASE64Encoder();
            String result=be.encode(md.digest());
            return result;
        } catch (NoSuchAlgorithmException e) {
            return "";
        }
    }
}
